<?php
/**
 * article table
 * 'title', 'short_title', 'descrition', 'image_id', 'image_id_list', 'content', 'uid'
 *
 */
namespace backend\models;

use Yii;
use yii\db\ActiveRecord;
class ProductItem extends ActiveRecord{


	public function scenarios(){
		return [
			'create' => ['product_id', 'item_id', 'type'],
		];
	}

	public function rules(){

		return [
			[['product_id', 'item_id', 'type'], 'required'],

			['product_id', 'exist', 'targetClass' => 'backend\models\Product', 'targetAttribute' => ['product_id'=> 'id']],

			['item_id', 'integer'],
			
			['type', 'in', 'range' => ['goods', 'human', 'article']],
		];
	}

	public function checkItemId(){

	}
}